import React from 'react';
import PropTypes from 'prop-types'
import './Header.css'

//公共组件，需要变量类型声明
Header.propTypes = {//这里propType p为小写，大写报错
    onBack: PropTypes.func.isRequired,
    title: PropTypes.string.isRequired,
}



export default function Header(props) {
    const {
        onBack,
        title,
    } = props;


    return (
        <div className="header">
            <div className="header-back" onClick={onBack}>
                {/* 绘制箭头 */}
                <svg width="42" height="42">
                    <polyline
                        points="25,13,16,21,25,29"
                        stroke="#fff"
                        strokeWidth="2"
                        fill="none"
                    />
                </svg>
            </div>
            <h1 className="header-title">{title}</h1>
        </div>
    )
}


